package cn.sccl.dirms.topo.discovery.model;

import cn.sccl.common.exception.BusinessException;
import cn.sccl.common.model.BaseModel;

/**
* 自动发现任务队列表
* 数据库表 T_TOPO_DISCOVER_TASK_QUEUE 的实体对象
* Created by _minus on 2017-09-28.
*/
public class DiscoverTaskQueue extends BaseModel{
   /**
   *表名
   */
   public final static String TABLE_NAME ="t_topo_discover_task_queue";

    private String taskId;//任务的id
    private String status;//此次任务状态；-1失败，0：尚未开始，1：正在执行，2执行成功
    private java.sql.Timestamp startTime;//任务开始时间
    private java.sql.Timestamp endTime;//任务结束时间

    public void setTaskId(String taskId){
        this.taskId = taskId;
    }

    public String getTaskId(){
        return this.taskId;
    }
    public void setStatus(String status){
        this.status = status;
    }

    public String getStatus(){
        return this.status;
    }
    public void setStartTime(java.sql.Timestamp startTime){
        this.startTime = startTime;
    }

    public java.sql.Timestamp getStartTime(){
        return this.startTime;
    }
    public void setEndTime(java.sql.Timestamp endTime){
        this.endTime = endTime;
    }

    public java.sql.Timestamp getEndTime(){
        return this.endTime;
    }

    /**
    * clone一个对象。
    * @param cls 需要克隆的对象类型，只能是当前类的子类
    * @param <T>
    * @return
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
    public <T extends DiscoverTaskQueue> T clone(Class<T> cls) {
       try {
          T t = cls.newInstance();
          t.setId(this.getId());
          t.setDeleteFlag(this.isDeleteFlag());
          t.setCreateTime(this.getCreateTime());
          t.setUpdateTime(this.getUpdateTime());
          /*t.setPosition(this.getPosition());
          t.setUpdateUser(this.getUpdateUser());
          t.setCreateUser(this.getCreateUser());*/
          t.setTaskId(this.getTaskId());
          t.setStatus(this.getStatus());
          t.setStartTime(this.getStartTime());
          t.setEndTime(this.getEndTime());
          return t;
       } catch (Exception e) {
          e.printStackTrace();
          throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
       }
    }
}